﻿using GM_Shop.DAL;
using GM_Shop.Model.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GM_Shop.BLL
{
    public class CommodityInfo
    {
        public List<CCommodityInfo> getCommodityInfo()
        {
            return new SelectData().SelectCommodityInfo();
        }

        public string getCommodityName(int Id)
        {
            return new SelectData().SelectCommodityNameById(Id);
        }

        public CCommodityInfo getCommodityInfo(int id) { 
            return new SelectData().SelectCommodityInfo(id);
        }

        public List<PCommodityInfo> getCommodityInfoByCount(string typeName, string count)
        {
            int index = 0;
            if (int.TryParse(count, out int i))
                index = Convert.ToInt32(count);
            return new SelectData().SelectCommodityInfoByCount(typeName, index);
        }
    }
}
